<?php

// use Illuminate\Support\Facades\Schema;
use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitWithdraw extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('withdraw_records', function (Blueprint $table) {
            $table->comment = '资产流水表';
                
            $table->increments('id');
            $table->uuid('uuid')->index();

            $table->integer('user_id')->unsigned()->index()->comment('用户id'); // 财产类型id
            $table->integer('asset_id')->unsigned()->index()->comment('资产id'); // 财产类型id
            $table->string('asset_type', 20)->index()->comment('资产类型'); // 财产类型id

            // $table->bigInteger('before')->unsigned()->comment('变动前余额'); 
            // $table->bigInteger('after')->unsigned()->comment('变动后余额'); 
            $table->bigInteger('value')->unsigned()->comment('数额'); 

            $table->string('withdraw_type', 10)->index()->comment('提现方式: wechat微信、 alipay支付宝、 bank银行'); 

            $table->string('phone', 22)->nullable()->comment('手机号'); 
            $table->string('account')->nullable()->comment('帐户信息'); 

            $table->json('options')->nullable()->comment('备注'); // 备注

            $table->boolean('status')->default(0)->index()->comment('0为审核中  1已完成  2已取消'); 

            $table->timestamp('handled_at')->nullable()->comment('处理时间');

            $table->string('remark', 255)->nullable()->comment('管理后台备注'); 

            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('withdraw_records');
    }
}
